-
Notifications
You must be signed in to change notification settings - Fork 123
Add new HTTPConnectionPool Manager #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: George Barnett <[email protected]>
final class Manager { | ||
private typealias Key = ConnectionPool.Key | ||
|
||
enum State { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: private
} | ||
|
||
deinit { | ||
guard case .shutDown = self.state else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about shutting down? You could call shutdown and not bother waiting for the future to complete as well, I assume?
} | ||
} | ||
|
||
func shutdown(on eventLoop: EventLoop) -> EventLoopFuture<Bool> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the Bool
here?
self.state = .shutDown | ||
return .done(future) | ||
} else { | ||
let promise = eventLoop.makePromise(of: Bool.self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth a comment here to indicate when this promise is completed.
|
||
case .shuttingDown(let promise, let soFarUnclean): | ||
guard self._pools.removeValue(forKey: pool.key) === pool else { | ||
preconditionFailure("Expected that the pool was ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That suspense is killing me!
let eventLoopGroup: EventLoopGroup | ||
let configuration: HTTPClient.Configuration | ||
let connectionIDGenerator = Connection.ID.globalGenerator | ||
let logger: Logger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Follow up to #418